package com.zczc.web;

import com.github.pagehelper.PageInfo;
import com.zczc.entity.MessageInfo;
import com.zczc.service.MessageInfoService;
import java.util.ArrayList;
import java.util.List;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

/**
 * @Author:Mark
 * @Description:
 * @Date: Created on 15:32 2018-12-12
 * @Modify by:
 */
@RunWith(SpringRunner.class)
@SpringBootTest
public class RunTestAA {

  @Autowired
  private MessageInfoService messageInfoService;

  @Test
  public void testQueryMessage(){
    MessageInfo messageInfo=new MessageInfo();
    messageInfo.setTitle("放假了。。。");
    PageInfo<MessageInfo> pageInfo = messageInfoService
        .selectMessageInfoByPage(messageInfo, null, null);
    System.out.println(pageInfo);
  }

  @Test
  public void testAddMessage(){
    MessageInfo messageInfo=new MessageInfo();
    messageInfo.setTitle("放假了。。。");
    messageInfo.setContent("发错消息了，收回");
    String msg=messageInfoService.addMessageInfoSelective(messageInfo)?"成功":"失败";
    System.out.println(msg);
  }


  @Test
  public void testUpdateMessage(){
    MessageInfo messageInfo=new MessageInfo();
    messageInfo.setId("c4003466-3625-465c-96ed-678e2eab0adcXXX");
    messageInfo.setTitle("AAA了。。。");
    messageInfo.setContent("发错AAAAA息了，收回");
    String msg=messageInfoService.updateMessageInfoSelective(messageInfo)?"成功":"失败";
    System.out.println(msg);
  }

  @Test
  public void testdeleteMessage(){
    List<String> ids =new ArrayList<>();
    ids.add("c4003466-3625-465c-96ed-678e2eab0adc");
    ids.add("dbcf5c99-ce91-483b-b7ba-7afafa2b7075");
    String msg=messageInfoService.deleteMessageInfoByIdLogic(ids)?"成功":"失败";
    System.out.println(msg);
  }


}
